﻿/*
 * KLF Headless Browser
 * Written by Kris Oye <kristianoye@gmail.com>
 * Copyright (C) 2011-2012.  All rights reserved.
 */
namespace KLF.Lib.Browser.DOM.HTML
{
    #region Using Statements

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;

    #endregion

    /// <summary>
    /// Form field label text. See the LABEL element definition in HTML 4.01.
    /// </summary>
    public class HTMLLabelElement : HTMLFormElementBase
    {
        #region Constructors

        internal HTMLLabelElement(Document owner)
            : base(owner, HTMLConstants.HTML_TAG_LABEL)
        {
        }

        #endregion

        #region DOM Level 2 HTML Compliance

        /// <summary>
        /// A single character access key to give access to the form control.
        /// See the accesskey attribute definition in HTML 4.01.
        /// </summary>
        public string accessKey
        {
            get
            {
                return getAttribute(HTMLConstants.HTML_ATT_ACCESSKEY);
            }
            set
            {
                if (String.IsNullOrEmpty(value))
                    removeAttribute(HTMLConstants.HTML_ATT_ACCESSKEY);
                else
                    setAttribute(HTMLConstants.HTML_ATT_ACCESSKEY, value);
            }
        }

        /// <summary>
        /// This attribute links this label with another form control by id attribute. 
        /// See the for attribute definition in HTML 4.01.
        /// </summary>
        public string htmlFor
        {
            get
            {
                return getAttribute(HTMLConstants.HTML_ATT_FOR);
            }
            set
            {
                if (String.IsNullOrEmpty(value))
                    removeAttribute(HTMLConstants.HTML_ATT_FOR);
                else
                    setAttribute(HTMLConstants.HTML_ATT_FOR, value);
            }
        }

        #endregion
    }
}
